<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>closeNumber</title>
  <script>
    var arr = [];
    for (var i = 1; i <= 2000 ; i++)
    {
        var sum1 = 0;
        var num = i;
        for (var k = parseInt(i / 2); k > 0; k--){
                if (num % k == 0)
                    sum1 += k;
        }
        var sum2 = 0;
        var arr1 = []
        for (var j = parseInt(sum1 / 2); j > 0; j--){
            if(sum1 % j == 0)
              sum2 += j;
        }
        if (sum2 == num && i < sum1)
        {
          arr1.push(i);
          arr1.push(sum1);
          arr.push(arr1);
        }
    }
    console.log(arr);
  </script>
</head>
<body>
  
</body>
</html>